new Vue({
	el: '#app',
	// 选项
	data: {
		uid: '',
		qid: '',
		content: ''
	},
	mounted: function() {
		this.init();
	},
	methods: {
		init: function() {
			this.uid = $api.getStorage('uid');
		},
		//发布回答并跳转
		sendMsg: function() {
			var self = this;
			var fid = api.pageParam;
			self.qid = fid.qid;
			var data = {
				content: self.content,
				sns_question_id: self.qid,
				user_id: self.uid
			}
			$.post(base + config.sns_answer_add, data, function(msg) {
				console.log(msg);
				if(msg.error == 0) {
					self.content = "";
					api.openWin({
						name: 'question-details',
						url: 'questionDetails.html',
						vScrollBarEnabled: false,
						reload: true,
						pageParam: {
							qid: self.qid,
							name: 'reply-topic',
						}
					});
				} else {
					console.log(msg.error_msg);
					api.toast({
						msg: msg.error_msg,
						duration: 2000,
						location: 'middle'
					});
				}
			}, 'json');

		}
	}
})